package cll;

import static cll.Parameters.alphaT;
import static cll.Parameters.dt;
import static cll.Parameters.duree_persistence_deplacement_TC;
import static cll.Parameters.vitesse_CC;

import org.apache.commons.math3.random.RandomDataImpl;

public class OutputCell extends Cell{

	
	
	public OutputCell(Centrocyt centrocyt) {
		positionspeed = centrocyt.positionspeed.copy();
		environment = centrocyt.environment;
		type = Type.OutputCell;
		antigen=centrocyt.antigen;
		//CD38 = centrocyt.CD38;
		rayon =5;
	}

	public void changeDirection() {
		if(Math.random() < dt/duree_persistence_deplacement_TC){
			Place myplace = environment.getPlace(positionspeed);
			double anglePrivilegie= myplace.getDirection12();
			double randomDirection = (Math.random()-0.5)*2*Math.PI;
			
			double vx = alphaT*Math.cos(anglePrivilegie) + Math.cos(randomDirection);
			double vy = alphaT*Math.sin(anglePrivilegie) + Math.sin(randomDirection);
			
			double newDirection = Math.atan2(vy, vx);
			
			RandomDataImpl distribution = new RandomDataImpl();
			double valeur = distribution.nextPoisson(vitesse_CC);
			
			positionspeed.changeSpeed(newDirection,valeur );
		}
	}
	public Cell transforme() {
		return new DeadCell();
	}

	public void apoptosis() {
		
	}

	public void dealWithChemokine() {
		
	}
	public void interaction() {
		
	}


	public void transition() {

		
	}


	public Cell Reproduction() {
		return new DeadCell();
	}

	@Override
	public void interaction(Cell c) {
		// TODO Auto-generated method stub
		
	}

}
